package com.hundsun.fcp.adapter;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.hundsun.fcp.R;
import com.hundsun.fcp.bean.ActionCenter;
import com.hundsun.fcp.common.utils.DisplayImageOptionsUtil;
import com.nostra13.universalimageloader.core.ImageLoader;

public class ActionCenterAdapter extends Adapter<ActionCenter> {

	private ImageLoader mImageLoader;

	public ActionCenterAdapter(Context context) {
		super(context, R.layout.fcp_mine_actioncenter_item);
		mImageLoader = ImageLoader.getInstance();
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		ViewHolder holder = null;

		if (convertView == null) {
			holder = new ViewHolder();
			convertView = mInflater.inflate(mLayoutResId, null);
			holder.mActivitiesIv = (ImageView) convertView.findViewById(R.id.iv_action);
			holder.mActivitiesDescTv = (TextView) convertView.findViewById(R.id.tv_content_action);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}

		final ActionCenter actionCenter = mDataList.get(position);
		mImageLoader.displayImage(actionCenter.getImgurl(),holder.mActivitiesIv,DisplayImageOptionsUtil.actionImageOptions());
		holder.mActivitiesDescTv.setText(actionCenter.getDescribe());

		return convertView;
	}

	
	class ViewHolder {
		/** 活动图片 */
		ImageView mActivitiesIv;
		/** 活动描述 */
		TextView mActivitiesDescTv;
	}

}
